package com.heritage.dto.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommentResponse {
    private Long id;
    private String content;
    private Long userId;
    private String username;
    private String userAvatar; // 可选，用户头像
    private Long heritageId;
    private LocalDateTime createdAt;
    
    // 添加一个用于评论列表的静态工厂方法
    public static CommentResponse fromComment(Long id, String content, Long userId, 
                                             String username, String userAvatar, 
                                             Long heritageId, LocalDateTime createdAt) {
        CommentResponse response = new CommentResponse();
        response.setId(id);
        response.setContent(content);
        response.setUserId(userId);
        response.setUsername(username);
        response.setUserAvatar(userAvatar);
        response.setHeritageId(heritageId);
        response.setCreatedAt(createdAt);
        return response;
    }
}
